package com.yc.blog.thread;

import java.util.concurrent.TimeUnit;

public class TestSleep {
	
	public void m() {
		System.out.println("--start--");
		
		//当前线程等待3秒
		try {
			Thread.sleep(3000);//3000毫秒=3秒
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		System.out.println("--end--");
	}
	
	public void m2() {
		System.out.println("--start--");
		
		//当前线程等待3秒
		try {
			TimeUnit.SECONDS.sleep(3);
			Thread.sleep(3000);//3000毫秒=3秒
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		System.out.println("--end--");
	}

	public static void main(String[] args) {
		TestSleep ts = new TestSleep();
		ts.m();

	}

}
